package com.ezzd;

/**
 * User: 被遗忘的湫
 * Date: 2022/7/28
 * Time: 20:57
 */
public enum EnmuInfo {
    Success("成功", 1), Fail("失败", 2);
    // 成员变量
    private String msg;
    private int code;
    // 构造方法
    private EnmuInfo(String msg, int code) {
        this.msg = msg;
        this.code = code;
    }
    // 普通方法
    public static String getMsg(int code) {
        for (EnmuInfo enmuInfo : EnmuInfo.values()) {
            if (enmuInfo.getCode() == code) {
                return enmuInfo.msg;
            }
        }
        return null;
    }
    // get set 方法

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}